﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using Wwtfly.BBS.BackModels.Models.Users;

namespace Wwtfly.BBS.BackModels.Models.Users.BBSPortalIdentity
{
    /// <summary>
    /// 后台 用户
    /// </summary>
    public class BBSPortalIdentity : GenericPrincipal
    {

        private UsersModel _userInfo;

        /// <summary>
        /// 当前用户..
        /// </summary>
        public UsersModel UserInfo
        {
            get { return _userInfo; }
           private set { _userInfo = value; }
        }
         
        public void SetCurrentUser(UsersModel userInfo)
        {
            this.UserInfo = userInfo;
        }

        public override string ToString()
        {
            string[] result = new string[] { _userInfo.UserName, _userInfo.Id.ToString(), _userInfo.UserMobile };
            return string.Join("&", result);
        }
 

        /// <summary>
        /// 构造 函数
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="roles"></param>
        public BBSPortalIdentity(IIdentity identity, string[] roles)
            : base(identity, roles)
        {
        }

        public override bool IsInRole(string role)
        {
            return false;
        }
    }
}
